/*
class Solution {
    private ArrayList<ArrayList<Integer>> paths = new ArrayList<>();
    private Stack<Integer> path = new Stack<>();
    public ArrayList<ArrayList<Integer>> FindPath(TreeNode root,int target) {
        if(root ==null) return paths;
        path.push(root.val);
        target -= root.val;
        if(target == 0 && root.left == null && root.right ==null){
            paths.add(new ArrayList<Integer>(path));
        }
        FindPath(root.left,target);
        FindPath(root.right,target);
        path.pop();
        return paths;
    }
}*/

import java.util.*;
/*
public class Test {
    public static void main(String[] args) {
        Stack<Integer> path = new Stack<>();
        Queue<Integer> path2 = new LinkedList<>();
        path.push(1);
        path.push(2);
        path.push(3);
        path2.offer(1);
        path2.offer(2);
        path2.offer(3);

        ArrayList<Integer>list = new ArrayList<>(path);
        ArrayList<Integer>list1 = new ArrayList<>(path2);

        System.out.println(list);
        System.out.println(list1);
    }
}*/



import java.util.*;
/*public class Solution {
    ArrayList<TreeLinkNode> nodes = new ArrayList<>();
    public TreeLinkNode GetNext(TreeLinkNode pNode) {
        // 获取根节点
        TreeLinkNode root = pNode;
        while(root.next != null) root = root.next;

        // 中序遍历打造nodes
        InOrder(root);

        // 进行匹配
        int n = nodes.size();
        for(int i = 0; i < n - 1; i++) {
            TreeLinkNode cur = nodes.get(i);
            if(pNode == cur) {
                return nodes.get(i+1);
            }
        }
        return null;
    }

    // 中序遍历
    void InOrder(TreeLinkNode root) {
        if(root != null) {
            InOrder(root.left);
            nodes.add(root);
            InOrder(root.right);
        }
    }
}*/









import java.util.*;
/*
public class Solution {
    private int res = 0;
    //dfs查询以某结点为根的路径数
    private void dfs(TreeNode root, int sum){
        if(root == null)
            return;
        //符合目标值
        if(sum == root.val)
            res++;
        //进入子节点继续找
        dfs(root.left, sum - root.val);
        dfs(root.right, sum - root.val);
    }
    //dfs 以每个结点作为根查询路径
    public int FindPath (TreeNode root, int sum) {
        //为空则返回
        if(root == null)
            return res;
        //查询以某结点为根的路径数
        dfs(root, sum);
        //以其子结点为新根
        FindPath(root.left, sum);
        FindPath(root.right, sum);
        return res;
    }
}
*/
















